#include<iostream>
using namespace std;
int main(){
	int i=1;
	int sum=0;
	while(i<=10){
		if((i%3)==0 && (i%10)==3){
			i++;
			continue;
		}
		sum+=i;
		i++;
	}
	printf("%d",sum);
} 
